# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>

pkgname=stuntrally-data
_pkgname=stuntrally
pkgver=1.9
pkgrel=1
pkgdesc="Stunt Rally game with track editor, based on VDrift (data files)"
arch=('any')
license=('GPL3')
url="http://code.google.com/p/vdrift-ogre"
makedepends=('cmake' 'boost' 'libvorbis' 'mygui' 'sdl' 'enet' 'hicolor-icon-theme' 'libxcursor')
source=(src_${pkgver}.tar.gz::https://nodeload.github.com/${_pkgname}/stuntrally/tar.gz/${pkgver}
        tracks_${pkgver}.tar.gz::https://nodeload.github.com/${_pkgname}/tracks/tar.gz/${pkgver})
md5sums=('3253c5a64a6d3f4fc4b756ea431286de'
         '77e118926c970a445b91d688a4f46799')

build() {
  # build the sources
  cd "${srcdir}/stuntrally-${pkgver}/"

  rm -rf build
  mkdir build && cd build

  cmake -DCMAKE_INSTALL_PREFIX="/usr" -DSHARE_INSTALL="share/stuntrally" ..
  make

  # build the tracks
  cd "${srcdir}/tracks-${pkgver}/"

  rm -rf build
  mkdir build && cd build

  cmake -DCMAKE_INSTALL_PREFIX="/usr" ..
  make
}

package() {
  #install the sources
  cd "${srcdir}/stuntrally-${pkgver}/build/"

  make DESTDIR="${pkgdir}" install


  # install the tracks
  cd "${srcdir}/tracks-${pkgver}/build"

  make DESTDIR="${pkgdir}/usr/share/stuntrally/" install

  rm -rf "${pkgdir}/usr/share/stuntrally/tracks/build"
  rm -rf "${pkgdir}/usr/share/icons"
  rm -rf "${pkgdir}/usr/share/applications"
  rm -rf "${pkgdir}/usr/bin"
}
